import request from '@/utils/request'

/**
 * 获取员工列表
 */
export const getEmployeeListApi = (page, size) => {
  return request({
    url: '/sys/user',
    params: {
      page,
      size
    }
  })
}

/**
 * 删除员工
 */
export const delEmployeeApi = (id) => {
  return request({
    url: `/sys/user/${id}`,
    method: 'delete'
  })
}

/**
 * 添加员工
 */
export const addEmployeeApi = data => {
  return request({
    url: '/sys/user',
    method: 'post',
    data
  })
}

/**
 * 批量添加员工
 */
export const batchAddEmployeeApi = list => {
  return request({
    url: '/sys/user/batch',
    method: 'post',
    data: list
  })
}

/**
 * 修改员工信息
 */
export const editEmployeeApi = data => {
  return request({
    url: `/sys/user/${data.id}`,
    method: 'put',
    data
  })
}

/**
 * 分配用户角色信息
 */
export const assignRoleApi = (id, roleIds) => {
  return request({
    url: '/sys/user/assignRoles',
    method: 'put',
    data: {
      id,
      roleIds
    }
  })
}
